fuse: add subvol_root_ino mount option for subvolume support#192
fuse: add subvol_root_ino mount option for subvolume support#192ukernel wants to merge 1 commit into
Conversation
|
the reason we don't use submount feature is that: |
|
I don't think this is what we want unless someone convinces me how this works with the fallback fuse module. |
1a24e23 to
88683ed
Compare
| if (fc->subvol_root_ino && fi->orig_ino == fc->subvol_root_ino) { | ||
| int err = get_anon_bdev(&get_fuse_inode(inode)->sub_dev); | ||
| if (err) | ||
| pr_warn("failed to alloc anon bdev\n"); |
There was a problem hiding this comment.
If we get to this error condition, i think fi->sub_dev is still unallocated, and err should be the errno. Should we return err here rather than continue with a null fi->sub_dev ?
There was a problem hiding this comment.
I think it's not good to return error while inode is in NEW state.
| fuse_init_inode(inode, attr, fc); | ||
| fi->orig_ino = attr->ino; | ||
| if (fc->subvol_root_ino && fi->orig_ino == fc->subvol_root_ino) { | ||
| int err = get_anon_bdev(&get_fuse_inode(inode)->sub_dev); |
There was a problem hiding this comment.
also, it looks like we only set sub_dev when the state is new. but if a process were to hold a file open while another process evicts the parent, i /think/ the child stays cached with a stale sub_dev until it closes
There was a problem hiding this comment.
the sub_dev will get re-used if someone lookup its parent again. because d_splice_alias will try hard to re-use the original parent.
Filesystems that support snapshots and subvolumes may have inodes with the same inode number across different subvolumes. When these inodes are accessed through the same FUSE mount, tools like cp(1) can incorrectly report "File X and Y are the same file" because they share the same device number (sb->s_dev). Add a new mount option "subvol_root_ino" that specifies the inode number of snapshot/subvolume root. When set, FUSE allocates unique anonymous block device ID for inodes whose orig_ino matches this value, and all inodes under that subvolume inherit the same device ID. This gives each subvolume a distinct device number in stat(2), avoiding inode number conflicts. The feature is implemented by: - Adding sub_dev to fuse_inode, to track per-subvolume device ID - Adding subvol_root_ino to fuse_conn - Extending fuse_iget and fuse_lookup_name to propagate sub_dev - Reporting fi->sub_dev in fuse_fillattr/fuse_getattr when set - Disabling NFS export_support when subvol_root_ino is enabled, since the two features are incompatible Signed-off-by: "Yan, Zheng" <ukernel@gmail.com>
88683ed to
7269925
Compare
Filesystems that support snapshots and subvolumes may have inodes with the same inode number across different subvolumes. When these inodes are accessed through the same FUSE mount, tools like cp(1) can incorrectly report "File X and Y are the same file" because they share the same device number (sb->s_dev).
Add a new mount option "subvol_root_ino" that specifies the inode number of snapshot/subvolume root. When set, FUSE allocates unique anonymous block device ID for inodes whose orig_ino matches this value, and all inodes under that subvolume inherit the same device ID. This gives each subvolume a distinct device number in stat(2), avoiding inode number conflicts.
The feature is implemented by: